<?php

class FormRegister extends Zend_Form {
	
	public function __construct($options = null) {

		parent::__construct ( $options );

		$this->setDecorators(array(
            'FormElements',
             array(
             'Description', array('placement' => 'prepend', 'tag' => 'fieldset' ,  'class' => 'erro')
             ),
            'Form'
        ));
		
	 	$decoratorField = array(
	 	'ViewHelper',
	 	array('Description', array('tag' => '')),
	 	'Errors','Label');
		$decoratorButton = array('ViewHelper');
	 	
		$name = new Zend_Form_Element_Text ( 'name' );
		$name->setLabel ( "Name:" );
		$name->setDecorators($decoratorField);
		$name->setRequired ( true )
		->addValidator ( new Zend_Validate_StringLength(5,70));
		$this->addElement ( $name );
		
		$email = new Zend_Form_Element_Text ( 'email' );
		$email->setLabel ( "E-mail:" );
		$email->setDecorators($decoratorField);
		$email->setRequired ( true )
		->addValidator ( new Zend_Validate_EmailAddress());
		$this->addElement ( $email );
		
		$login = new Zend_Form_Element_Text ( 'login' );
		$login->setLabel ( "Login:" );
		$login->setDecorators($decoratorField);
		$login->setRequired ( true )->addFilter ( 'StringToLower' )
		->addValidator ( new Zend_Validate_StringLength(5,50)); //TODO Add a validator for uniqueness
		$this->addElement ( $login );
					
		$senha = new Zend_Form_Element_Password ( 'pass' );
		$senha->setLabel ( "Password:" );
		$senha->setRequired ( true )
		->addValidator ( new Zend_Validate_StringLength(6,20) );
		$senha->setDecorators($decoratorField);
		$this->addElement ( $senha );
		
		$submit = new Zend_Form_Element_Submit ( 'Submit' );
		$submit->setAttrib('class', 'button');
		$submit->setDecorators($decoratorButton);
		$this->addElement ( $submit );		

	
	}


}

?>
